<?php
/**
 * Description:
 *
 * @author      Eden
 * @datetime    2017/2/3 17:27
 * @copyright   WuHan HuQi Technology Co.,Ltd.
 * @url         http://cnhuqi.com
 */

class Base extends WX_Controller
{
    /**
     * 初始化
     * @throws Exception
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 基地详情
     */
    public function detail()
    {
        if (!empty($this->openId)) {

            $baseId = $this->input->get('baseId');
            if (intval($baseId) < 0) {
                $this->outputError('参数错误');
            }

            $this->load->model('wx/user/Base_Model', 'base');
            $baseDetail = $this->base->getBaseDetailByBaseId($baseId);
            if (empty($baseDetail)) {
                $this->outputError('用户不存在');
            }

            @statIncr('pv');
            $this->output(!empty($baseDetail) ? $baseDetail : []);

        } else {
            $this->outputError(self::NO_LOGIN);
        }
    }

}
